#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <limits>
#include <vector>
#include "../convex_hull.h"

int main()
{
    size_t n;
    std::cin >> n;

    std::vector<point> vertices;
    vertices.resize(n);

    for (size_t i = 0; i < n; i++) {
        std::cin >> vertices[i];
    }

    if (n == 1)
    {
        std::cout << vertices[0].x << " " << vertices[0].y << "\n";
    }

    auto convex_hull = convex_hull_wrapper(vertices);

    std::cout << convex_hull - vertices.begin() + 1 << "\n";

    std::cout.precision(42);

    for (auto it = vertices.begin(); it != convex_hull + 1; ++it)
    {
        std::cout << *it << "\n";
    }
}